package com.itlong.cloud.user.sdk;

import com.alibaba.fastjson.JSONObject;
import com.itlong.cloud.POJO.VO.sdk.old.SDKAppOldUserBasicsInfoVO;
import com.itlong.cloud.POJO.VO.sdk.old.SDKAppOldUserInfoCacheVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * <desc>
 *      旧版APP_SDK用户服务暴露层接口
 * </desc>
 *
 * @createDate 2017-11-08
 */
@FeignClient(name = "user-service")
public interface ISDKAppOldUserServiceClient {

    /**
     * <desc>
     *    从缓存中获取SDK登录用户的信息.
     * </desc>
     *
     * @param appid 应用接入凭证
     *@param phoneNo 用户手机号
     * @return 手机APP SDK用户数据传输对象
     * @author LewisLouis
     * @createDate 2017-11-08
     */
    @RequestMapping(path = "/sdk/appUser/getSDKAppCacheUser",method = RequestMethod.POST)
    SDKAppOldUserInfoCacheVO getSDKAppCacheUser(@RequestParam("appid")String appid, @RequestParam("phoneNo")String phoneNo);


    /**
     * <desc>
     *    保存SDK登录的用户信息到缓存.
     * </desc>
     *
     * @param sdkAppUserVO 手机APP SDK用户数据传输对象
     * @author LewisLouis
     * @createDate 2017-11-08
     */
    @RequestMapping(path = "sdk/appUser/saveSDKAppCacheUser",method = {RequestMethod.POST})
    void saveSDKAppCacheUser(@RequestBody SDKAppOldUserInfoCacheVO sdkAppUserVO);



    /**
     * <desc>
     * 从数据库中获取SDK登录用户的基础信息.
     * </desc>
     *
     * @param phoneNo 用户手机号
     * @return 手机APP SDK用户数据传输对象
     * @author LewisLouis
     * @createDate 2017-11-13
     */
    @RequestMapping(path = "sdk/appUser/getSDKAppUserBasicInfo",method = {RequestMethod.POST})
    SDKAppOldUserBasicsInfoVO getSDKAppUserBasicInfo(@RequestParam("phoneNo")String phoneNo);


    /**
     * <desc>
     * 根据手机号和应用接入凭证，查找对应的项目信息.
     * </desc>
     *
     * @param phoneNo 手机号
     * @param appId   应用接入凭证
     * @return 项目信息列表
     * @author LewisLouis
     * @createDate 2017-11-14
     */
    @RequestMapping(path = "sdk/appUser/getProjectInfos",method = {RequestMethod.POST})
    List<String> getProjectInfos(@RequestParam("phoneNo")String phoneNo, @RequestParam("appId")String appId);


    /**
     * <desc>
     *    根据用户Id和项目Id，查找对应的项目信息.
     * </desc>
     *
     * @param userId 用户Id
     *@param projectId 项目编号
     * @return 用户的项目相关信息（包括项目相关配置\住址列表等）
     * @author LewisLouis
     * @createDate 2017-11-14
     */
    @RequestMapping(path = "sdk/appUser/getUserProjectInfo",method = {RequestMethod.POST})
    JSONObject getUserProjectInfo(@RequestParam("userId")String userId, @RequestParam("projectId")String projectId);


    /**
     * <desc>
     * 获取指定用户的所在房间的其中一个业主的电话号码
     * </desc>
     *
     * @param userId
     * @return 业主电话号码
     * @author LewisLouis
     * @createDate 2017-11-15
     */
    @RequestMapping(path = "sdk/appUser/getOneParentPhoneNoByUserId",method = {RequestMethod.POST})
    String getOneParentPhoneNoByUserId(@RequestParam("userId")String userId);


    /**
     * <desc>
     * 获取用户指定项目中的一卡通软卡号（系统编号）
     * </desc>
     *
     * @param userId    用户Id
     * @param projectId 项目Id
     * @return 一卡通软卡号（系统编号）.
     * @author LewisLouis
     * @createDate 2017-11-16
     */
    @RequestMapping(path = "sdk/appUser/getUserCardNo",method = {RequestMethod.POST})
    String getUserCardNo(@RequestParam("userId")String userId, @RequestParam("projectId")String projectId);
}
